%\documentclass{article}
%\usepackage{tikz}
%
%\begin{document}\pagestyle{empty}
\documentclass{article}
 
\usepackage[pdftex,active,tightpage]{preview}
\usepackage{tikz}
\usetikzlibrary{snakes}
\usetikzlibrary{arrows}
\makeatletter
 
\begin{document}
\begin{preview}
	%%
	\begin{tikzpicture}[scale=0.9]
	
	\draw[very thin,color=gray] (-0.1,-0.1) grid (12,4.5);
	\draw[->] (-0.2,0) -- (12.2,0) node[right] {$p$};
	\draw[->] (0,-0.2) -- (0,4.6) node[above] {seconds};
	
	\foreach \pos/\label in {0.5/1,1.5/2,2.5/4,3.5/8,4.5/16,5.5/32,6.5/64,7.5/128,8.5/256,9.5/512,10.5/1024,11.5/2048}
	\draw (\pos,0) -- (\pos,-0.1) (\pos cm,-2.5ex) node [anchor=base,fill=white,inner sep=1pt]  {\scriptsize \label};
	
	\draw[very thin,color=gray, xstep=1, ystep=0.5] (0, -4.5) grid (12,-0.5);
	\draw[fill=blue!50, fill opacity=0.5] (-3,-1.0) rectangle +(3,0.5);
	\draw (-1.5, -0.75) node {\scriptsize Octree Construction};
	
	\draw[fill=red!50, fill opacity=0.5] (-3,-1.5) rectangle +(3,0.5);
	\draw (-1.5, -1.25) node {\scriptsize Octree Balancing};
	
	\draw[fill=green!50, fill opacity=0.5] (-3,-2.0) rectangle +(3,0.5);
	\draw (-1.5, -1.75) node {\scriptsize Meshing };
	
	\draw[fill=orange!50, fill opacity=0.5] (-3,-2.5) rectangle +(3,0.5);
	\draw (-1.5, -2.25) node {\scriptsize \texttt{MatVec} (5)};
	
	\draw (-3,-3.0) rectangle +(3,0.5);
	\draw (-1.5, -2.75) node {\scriptsize Points};
	
	\draw (-3,-3.5) rectangle +(3,0.5);
	\draw (-1.5, -3.25) node {\scriptsize Unbalanced Octants};
	
	\draw (-3,-4.0) rectangle +(3,0.5);
	\draw (-1.5, -3.75) node {\scriptsize Balanced Octants};
	
	\draw (-3,-4.5) rectangle +(3,0.5);
	\draw (-1.5, -4.25) node {\scriptsize Vertices};
	
	\draw (-2.5ex, 0 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 0};
	
	\draw (-2.5ex, 1 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 15};
	
	\draw (-2.5ex, 2 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 30};
	
	\draw (-2.5ex, 3 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 45};
	
	\draw (-2.5ex, 4 cm) node [anchor=base,fill=white,inner sep=1pt] {\scriptsize 60};
	
	\newdimen\mypos
	\newdimen\myoff
	
	\foreach \pos/\vala/\valb/\valc/\vald in { 0/2.01/7.21/18.21/17.19, 1/3.44/7.06/23.12/20.25, 2/4.15/12.46/26.91/17.02, 3/3.47/11.64/25.72/20.16, 4/3.42/8.46/25.11/19.77, 5/3.83/12.57/25.74/20.07, 6/3.52/12.86/25.93/20.14, 7/3.42/12.65/26.85/20.94, 8/3.62/18.78/25.94/19.56, 9/4.16/13.83/29.21/18.88, 10/3.93/13.03/31.64/18.06, 11/4.67/14.31/27.94/17.97} { 
	\mypos=\pos cm
	\advance \mypos by 0.5 cm
	\draw (\mypos, -0.75 cm) node {\scriptsize \vala};
	\draw (\mypos, -1.25 cm) node {\scriptsize \valb};
	\draw (\mypos, -1.75 cm) node {\scriptsize \valc};
	\draw (\mypos, -2.25 cm) node {\scriptsize \vald};
	
	\myoff=0 cm
	
	\advance \mypos by -0.25 cm
	\draw[fill=blue!50, fill opacity=0.5, yscale=0.065782195151852213] (\mypos,\myoff) rectangle +(0.5,\vala);
	\advance \myoff by \vala cm
	\draw[fill=red!50, fill opacity=0.5, yscale=0.065782195151852213] (\mypos,\myoff) rectangle +(0.5,\valb);
	\advance \myoff by \valb cm
	\draw[fill=green!50, fill opacity=0.5, yscale=0.065782195151852213] (\mypos,\myoff) rectangle +(0.5,\valc);
	\advance \myoff by \valc cm
	\draw[fill=orange!50, fill opacity=0.5, yscale=0.065782195151852213] (\mypos,\myoff) rectangle +(0.5,\vald);
	\advance \myoff by \vald cm
	
	}
	
	\draw (0.5, -2.75) node {\scriptsize 1M};
	\draw (0.5, -3.25) node {\scriptsize 1.06M};
	\draw (0.5, -3.75) node {\scriptsize 1.06M};
	\draw (0.5, -4.25) node {\scriptsize 1.07M};
	\draw (1.5, -2.75) node {\scriptsize 2.05M};
	\draw (1.5, -3.25) node {\scriptsize 2.09M};
	\draw (1.5, -3.75) node {\scriptsize 2.09M};
	\draw (1.5, -4.25) node {\scriptsize 2.15M};
	\draw (2.5, -2.75) node {\scriptsize 3.94M};
	\draw (2.5, -3.25) node {\scriptsize 4.14M};
	\draw (2.5, -3.75) node {\scriptsize 4.14M};
	\draw (2.5, -4.25) node {\scriptsize 4.14M};
	\draw (3.5, -2.75) node {\scriptsize 8M};
	\draw (3.5, -3.25) node {\scriptsize 8.29M};
	\draw (3.5, -3.75) node {\scriptsize 8.29M};
	\draw (3.5, -4.25) node {\scriptsize 8.29M};
	\draw (4.5, -2.75) node {\scriptsize 15.8M};
	\draw (4.5, -3.25) node {\scriptsize 16.1M};
	\draw (4.5, -3.75) node {\scriptsize 16.1M};
	\draw (4.5, -4.25) node {\scriptsize 16.1M};
	\draw (5.5, -2.75) node {\scriptsize 31.8M};
	\draw (5.5, -3.25) node {\scriptsize 32.3M};
	\draw (5.5, -3.75) node {\scriptsize 32.3M};
	\draw (5.5, -4.25) node {\scriptsize 32.3M};
	\draw (6.5, -2.75) node {\scriptsize 63.5M};
	\draw (6.5, -3.25) node {\scriptsize 64.3M};
	\draw (6.5, -3.75) node {\scriptsize 64.3M};
	\draw (6.5, -4.25) node {\scriptsize 64.3M};
	\draw (7.5, -2.75) node {\scriptsize 127.3M};
	\draw (7.5, -3.25) node {\scriptsize 128M};
	\draw (7.5, -3.75) node {\scriptsize 128.5M};
	\draw (7.5, -4.25) node {\scriptsize 128.5M};
	\draw (8.5, -2.75) node {\scriptsize 248.8M};
	\draw (8.5, -3.25) node {\scriptsize 250.5M};
	\draw (8.5, -3.75) node {\scriptsize 250.5M};
	\draw (8.5, -4.25) node {\scriptsize 250.5M};
	\draw (9.5, -2.75) node {\scriptsize 504.5M};
	\draw (9.5, -3.25) node {\scriptsize 505.6M};
	\draw (9.5, -3.75) node {\scriptsize 505.6M};
	\draw (9.5, -4.25) node {\scriptsize 505.6M};
	\draw (10.5, -2.75) node {\scriptsize 1B};
	\draw (10.5, -3.25) node {\scriptsize 1B};
	\draw (10.5, -3.75) node {\scriptsize 1B};
	\draw (10.5, -4.25) node {\scriptsize 1B};
	\draw (11.5, -2.75) node {\scriptsize 1.96B};
	\draw (11.5, -3.25) node {\scriptsize 2B};
	\draw (11.5, -3.75) node {\scriptsize 2B};
	\draw (11.5, -4.25) node {\scriptsize 2B};
	\end{tikzpicture}%%
\end{preview}
\end{document}
%\end{document}
